package com.jzr.medical.controller.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jzr.common.entity.vo.Result;
import com.jzr.medical.db1.model.TCodeList;
import com.jzr.medical.db1.service.CodeListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/codelist")
public class CodeListController {
    @Autowired
    CodeListService codeListService;

    @GetMapping("/listItemByName")
    public Result<List<TCodeList>> listItemByName(String listName){
        QueryWrapper<TCodeList> qw = new QueryWrapper<>();
        qw.select("code,name");
        qw.orderByAsc("sort");
        qw.eq(TCodeList.ListName_,listName);

        List<TCodeList> list = codeListService.list(qw);
        return Result.success("成功",list);
    }

}
